package com.zs.usc.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;


/**
 * 流操作帮助类
 */
public class StreamUtils {

    private static final Logger LOG = LoggerFactory.getLogger(StreamUtils.class);

    public StreamUtils() {
    }

    public static void closeStream(InputStream stream) {
        try {
            if (stream != null) {
                stream.close();
            }
        } catch (Exception var2) {
            LOG.error("关闭输入流出错", var2);
        }

    }

    public static void closeStream(OutputStream stream) {
        try {
            if (stream != null) {
                stream.close();
            }
        } catch (Exception var2) {
            LOG.error("关闭输出流出错", var2);
        }

    }

    public static void closeStream(Writer writer) {
        try {
            if (writer != null) {
                writer.close();
            }
        } catch (Exception var2) {
            LOG.error("关闭输出字符流出错", var2);
        }

    }

    public static void closeStream(Reader reader) {
        try {
            if (reader != null) {
                reader.close();
            }
        } catch (Exception var2) {
            LOG.error("关闭输入字符流出错", var2);
        }

    }
}
